<template>
    <el-row class="menu_page">
        <el-col>
            <el-menu class="el-menu-vertical-demo" background-color="#324057" text-color="#fff"
                active-text-color="#ffd04b" mode="vertical">
                <router-link to="/">
                    <el-menu-item index="0">
                        <i class="el-icon-s-home"></i>
                        <span slot="title">首页</span>
                    </el-menu-item>
                </router-link>
                <router-link to="/backAbout">
                    <el-menu-item index="1">
                        <i class="el-icon-document"></i>
                        <span slot="title">宠物信息</span>
                    </el-menu-item>
                </router-link>
                <router-link to="/backKnow">
                    <el-menu-item index="2">
                        <i class="el-icon-paperclip"></i>
                        <span slot="title">养宠小知识</span>
                    </el-menu-item>
                </router-link>
                <router-link to="/backConsult">
                    <el-menu-item index="3">
                        <i class="el-icon-s-marketing"></i>
                        <span slot="title">宠物市场</span>
                    </el-menu-item>
                </router-link>
                <router-link to="/backComment">
                    <el-menu-item index="4">
                        <i class="el-icon-notebook-1"></i>
                        <span slot="title">留言管理</span>
                    </el-menu-item>
                </router-link>
                <router-link to="/backDoctor">
                    <el-menu-item index="5">
                        <i class="el-icon-folder-add"></i>
                        <span slot="title">兽医管理</span>
                    </el-menu-item>
                </router-link>
                <router-link to="/backNotice">
                    <el-menu-item index="6">
                        <i class="el-icon-s-order"></i>
                        <span slot="title">公告管理</span>
                    </el-menu-item>
                </router-link>
                <template v-for="item in items">
                    <el-submenu v-if="item.children" :index="item.path" :key="item.path">
                        <template slot="title">
                            <i :class="'el-icon-' + item.icon"></i>
                            <span slot="title">{{item.name}}</span>
                        </template>
                        <router-link v-for="(citem,cindex) in item.children" :to="citem.path" :key="cindex">
                            <el-menu-item :index="citem.path">
                                <i :class="'el-icon-' + citem.icon"></i>
                                <span slot="title">{{citem.name}}</span>
                            </el-menu-item>
                        </router-link>
                    </el-submenu>
                </template>
            </el-menu>
        </el-col>
    </el-row>
</template>

<script>
    export default {
        name: 'CommonAside',
        data() {
            return {
                items: [
                    {
                        icon: 'user',
                        name: '用户管理',
                        path: '',
                        children: [
                            {
                                path: '/admin',
                                name: '管理员',
                                icon: 'user-solid'
                            },
                            {
                                path: '/user',

                                name: '用户',
                                icon: 's-custom'
                            }
                        ]
                    }
                ]
            }
        }
    }
</script>
<style scoped>
.menu_page {
  position: fixed;
  top: 71px;
  left: 0;
  min-height: 100%;
  background-color: #324057;
  z-index: 99;
}
.el-menu {
  border: none;
}
.fa-margin {
  margin-right: 5px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 180px;
  min-height: 400px;
}
.el-menu-vertical-demo {
  width: 35px;
}
.el-submenu .el-menu-item {
  min-width: 180px;
}

.hiddenDropdown,
.hiddenDropname {
  display: none;
}
a {
  text-decoration: none;
}
.el-row{
    width: 180px;
}
</style>